home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
MPW_TOOL
/
TOOLS
/
TOOLS_WI
/
ICON_8
/
TESTS
/
KROSS.ICN
< prev
next >
Wrap
Text File
|
1990-03-02
|
669b
|
31 lines
#
# W O R D I N T E R S E C T I O N S
#
# This program procedure accepts string pairs from standard input, with
# the strings separated by semicolons. It then diagrams all the
# intersections of the two strings in a common character.
procedure main()
local line, j
while line := read() do {
write()
j := upto(':',line)
cross(line[1:j],line[j+1:0])
}
end
procedure cross(s1,s2)
local j, k
every j := upto(s2,s1) do
every k := upto(s1[j],s2) do
xprint(s1,s2,j,k)
end
procedure xprint(s1,s2,j,k)
write()
every write(right(s2[1 to k-1],j))
write(s1)
every write(right(s2[k+1 to *s2],j))
end